package com.example.demo.rabbitmq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PublishService {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void send(String msg) {
//        rabbitTemplate.convertAndSend("MEC1", "test.aaa", msg);
//        rabbitTemplate.convertAndSend("MEC1", "test.bbb", msg);
        rabbitTemplate.convertAndSend("MEC2", "test.aaa", msg);
        rabbitTemplate.convertAndSend("MEC2", "test.bbb", msg);
    }
}